<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsViewTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_view', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();

            $table->integer('goods_id')->unsigned()->comment('商品id');

            $table->integer('user_id')->unsigned()->nullable()->comment('用户id');

            $table->string('ip')->default('')->comment('ip');

        });

        DB::statement("ALTER TABLE `goods_view` COMMENT='商品浏览表'");//表注释
        DB::statement("ALTER TABLE `admins` COMMENT='管理员表'");//表注释
        DB::statement("ALTER TABLE `category` COMMENT='分类表'");//表注释
        DB::statement("ALTER TABLE `goods` COMMENT='商品表'");//表注释
        DB::statement("ALTER TABLE `goods_mode` COMMENT='商品模型表'");//表注释
        DB::statement("ALTER TABLE `goods_sku` COMMENT='商品sku表'");//表注释
        DB::statement("ALTER TABLE `goods_sku_detail` COMMENT='sku详情表'");//表注释
        DB::statement("ALTER TABLE `migrations` COMMENT='数据库迁移表'");//表注释
        DB::statement("ALTER TABLE `order_goods` COMMENT='订单商品表'");//表注释
        DB::statement("ALTER TABLE `shop_car` COMMENT='购物车表'");//表注释
        DB::statement("ALTER TABLE `user` COMMENT='用户表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_view');
    }
}
